HAL OSPI IO function migration

This section provides information about the HAL OSPI I/O functions migration.

HAL OSPI IRQ handler

HAL1

HAL2

HAL_OSPI_IRQHandler(OSPI_HandleTypeDef *hospi);
HAL_XSPI_IRQHandler(hal_xspi_handle_t *hxspi);

HAL OSPI command configuration functions

HAL OSPI command

HAL1

HAL2

HAL_OSPI_Command(OSPI_HandleTypeDef *hospi,
                 OSPI_RegularCmdTypeDef *cmd,
                 uint32_t Timeout);
HAL_XSPI_SendRegularCmd(hal_xspi_handle_t *hxspi,
                        const hal_xspi_regular_cmd_t *p_cmd,
                        uint32_t timeout_ms)

HAL OSPI command IT

HAL1

HAL2

HAL_OSPI_Command_IT(OSPI_HandleTypeDef *hospi,
                    OSPI_RegularCmdTypeDef *cmd);
HAL_XSPI_SendRegularCmd_IT(hal_xspi_handle_t *hxspi,
                           const hal_xspi_regular_cmd_t *p_cmd)

HAL OSPI hyperbus configuration

HAL1

HAL2

HAL_OSPI_HyperbusCfg(OSPI_HandleTypeDef *hospi,
                     OSPI_HyperbusCfgTypeDef *cfg,
                     uint32_t Timeout);
HAL_XSPI_SetConfig(hal_xspi_handle_t *hxspi,
                   const hal_xspi_config_t *p_config);

HAL OSPI hyperbus command

HAL1

HAL2

HAL_OSPI_HyperbusCmd(OSPI_HandleTypeDef *hospi,
                     OSPI_HyperbusCmdTypeDef *cmd,
                     uint32_t Timeout);
HAL_XSPI_SendHyperbusCmd(hal_xspi_handle_t *hxspi,
                         const hal_xspi_hyperbus_cmd_t *p_cmd,
                         uint32_t timeout_ms);

OSPI indirect mode functions

HAL OSPI transmit

HAL1

HAL2

HAL_OSPI_Transmit(OSPI_HandleTypeDef *hospi,
                  uint8_t *pData,
                  uint32_t Timeout);
HAL_XSPI_Transmit(hal_xspi_handle_t *hxspi,
                  const void *p_data,
                  uint32_t timeout_ms);

HAL OSPI receive

HAL1

HAL2

HAL_OSPI_Receive(OSPI_HandleTypeDef *hospi,
                 uint8_t *pData,
                 uint32_t Timeout);
HAL_XSPI_Receive(hal_xspi_handle_t *hxspi,
                 void *p_data,
                 uint32_t timeout_ms);

HAL OSPI transmit IT

HAL1

HAL2

HAL_OSPI_Transmit_IT(OSPI_HandleTypeDef *hospi,
                     uint8_t *pData);
HAL_XSPI_Transmit_IT(hal_xspi_handle_t *hxspi,
                     const void *p_data);

HAL OSPI receive IT

HAL1

HAL2

HAL_OSPI_Receive_IT(OSPI_HandleTypeDef *hospi,
                    uint8_t *pData);
HAL_XSPI_Receive_IT(hal_xspi_handle_t *hxspi,
                    void *p_data);

HAL OSPI transmit DMA

HAL1

HAL2

HAL_OSPI_Transmit_DMA(OSPI_HandleTypeDef *hospi,
                      uint8_t *pData);
HAL_XSPI_Transmit_DMA(hal_xspi_handle_t *hxspi,
                      const void *p_data);

HAL OSPI receive DMA

HAL1

HAL2

HAL_OSPI_Receive_DMA(OSPI_HandleTypeDef *hospi,
                     uint8_t *pData);
HAL_XSPI_Receive_DMA(hal_xspi_handle_t *hxspi,
                     void *p_data);

HAL OSPI status flag polling mode functions

HAL OSPI auto polling

HAL1

HAL2

HAL_OSPI_AutoPolling(OSPI_HandleTypeDef *hospi,
                     OSPI_AutoPollingTypeDef *cfg,
                     uint32_t Timeout);
HAL_XSPI_ExecRegularAutoPoll(hal_xspi_handle_t *hxspi
                             const hal_xspi_auto_polling_config_t *p_config,
                             uint32_t timeout_ms);

HAL OSPI auto polling IT

HAL1

HAL2

HAL_OSPI_AutoPolling_IT(OSPI_HandleTypeDef *hospi,
                        OSPI_AutoPollingTypeDef *cfg);
HAL_XSPI_ExecRegularAutoPoll_IT(hal_xspi_handle_t *hxspi,
                                const hal_xspi_auto_polling_config_t *p_config);

HAL OSPI memory-mapped mode functions

HAL OSPI memory mapped

HAL1

HAL2

HAL_OSPI_MemoryMapped(OSPI_HandleTypeDef *hospi,
                      OSPI_MemoryMappedTypeDef *cfg);
HAL_XSPI_StartMemoryMappedMode(hal_xspi_handle_t *hxspi,
                               const hal_xspi_memory_mapped_config_t *p_config);

HAL OSPI IO Manager configuration function

HAL OSPIM config

HAL1

HAL2

HAL_OSPIM_Config(OSPI_HandleTypeDef *hospi, OSPIM_CfgTypeDef *cfg, uint32_t Timeout);
HAL_XSPI_XSPIM_SetConfig(const hal_xspi_xspim_config_t *p_config);

Example usage

HAL1

HAL2

OSPI_HandleTypeDef hospi1;
OSPIM_CfgTypeDef sOspiManagerCfg;

/* Configure port 1 */
sOspiManagerCfg.DQSPort = 1;
sOspiManagerCfg.NCSPort = 1;
sOspiManagerCfg.IOPort = HAL_OSPIM_IOPORT_1_LOW;
HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE);


/* Configure port 2 */
sOspiManagerCfg.DQSPort = 1;
sOspiManagerCfg.NCSPort = 1;
sOspiManagerCfg.IOPort = HAL_XSPIM_IOPORT_2_LOW;
HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE);
hal_xspi_xspim_config_t sOspiManagerCfg;


/* Configure the OCTOSPIM port 1 */
sOspiManagerCfg.port1.clk = HAL_XSPI_XSPIM_XSPI1;
sOspiManagerCfg.port1.dqs = HAL_XSPI_XSPIM_XSPI1;
sOspiManagerCfg.port1.ncs = HAL_XSPI_XSPIM_XSPI1;
sOspiManagerCfg.port1.io_low = HAL_XSPI_XSPIM_XSPI1_IO_LOW;
sOspiManagerCfg.port1.io_high = HAL_XSPI_XSPIM_XSPI1_IO_HIGH

/* Configure the OCTOSPIM port 2 */
sOspiManagerCfg.port2.clk = HAL_XSPI_XSPIM_XSPI2;
sOspiManagerCfg.port2.dqs = HAL_XSPI_XSPIM_XSPI2;
sOspiManagerCfg.port2.ncs = HAL_XSPI_XSPIM_XSPI2;
sOspiManagerCfg.port2.io_low = HAL_XSPI_XSPIM_XSPI2_IO_LOW;
sOspiManagerCfg.port2.io_high = HAL_XSPI_XSPIM_XSPI2_IO_HIGH;

HAL_XSPI_XSPIM_SetConfig(&sOspiManagerCfg);